<script>

    let str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

    let cites = [
        { py: 'beijing', name: '北京' },
        { py: 'alishan', name: '阿里山' },
        { py: 'beidaihe', name: '北戴河' },
        { py: 'shijiazhuang', name: '石家庄' },
        { py: "guangzhou", name: "广州" }
    ]

    // 先来一个对象
    let obj={ }
    let arr=Array.from(str)
    // console.log(arr);
    arr.forEach(function(val){
        // obj.A=[]
        // obj.B=[]
        obj[val]=[]
    })
    // console.log(obj);


    
    cites.forEach(function(val){
        // console.log(val.py[0].toUpperCase());

        obj[val.py[0].toUpperCase()].push(val)
    })
    console.log(obj);




</script>